/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cms.dataaccess.hibernate;

import cms.dataaccess.ConfitemOrderDAO;
import cms.exceptions.HibernateAccessLayerException;
import dto.Confitemorder;
import dto.Confitemorder;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author eichawsan
 */
public class ConfitemOrderDAOImpl extends AbstractDAO implements ConfitemOrderDAO{

     public ConfitemOrderDAOImpl(){
        super();
    }
    public Confitemorder findConfitemorder(String ConfitemorderName) throws HibernateAccessLayerException {
      try {
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Finding Confitemorder" + ConfitemorderName);
            Confitemorder p = (Confitemorder) super.find(Confitemorder.class, ConfitemorderName);
            return p;
        } catch (Throwable t) {
            throw new HibernateAccessLayerException(t.toString());
            
        }
        
    }
    
    public List<Confitemorder> findAllConfitemorder() throws HibernateAccessLayerException {
        try {
            List result = super.findAll(Confitemorder.class);
            return (result);
        } catch (Throwable t) {
            throw new HibernateAccessLayerException(t.toString());
        }
        
    }
    
    public void insertConfitemorder(Confitemorder confitemorder) throws HibernateAccessLayerException {
        try {
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Inserting Confitemorder" + confitemorder.getId());
            super.saveOrUpdate(confitemorder);
        } catch (Throwable t) {
            throw new HibernateAccessLayerException(t.toString());
            
        }
    }
    
    public void updateConfitemorder(Confitemorder confitemorder) throws HibernateAccessLayerException {
         try {
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Updating Confitemorder" + confitemorder.getId());
            super.saveOrUpdate(confitemorder);
        } catch (Throwable t) {
            throw new HibernateAccessLayerException(t.toString());
            
        }
        
    }
    
    public void deleteConfitemorder(Confitemorder confitemorder) throws HibernateAccessLayerException {
        try {
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Deleting Confitemorder" + confitemorder.getId());
            super.delete(confitemorder);
        } catch (Throwable t) {
            throw new HibernateAccessLayerException(t.toString());
            
        }
    }
    
}
